package com.neu.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.neu.po.ResponseResult;
import com.neu.po.User;
import com.neu.service.UserService;

@RequestMapping("user")
@RestController
public class UserController {
		
	@Autowired
	private UserService userService;
	
	@RequestMapping("login")
	public ResponseResult login(String username , String password) {
		ResponseResult result =new ResponseResult();
		User login = userService.login(username, password);
		if(login == null) {
			result.setResult("error");
			result.setData("用户名或密码错误！请重试");
			return result;
		}else {
			result.setData(login);
		}
		return result;
	}
}
